package net.simflow.swf.analyzer.gui.ginfo.generator;

import java.util.ArrayList;
import java.util.LinkedHashMap;

import net.simflow.swf.analyzer.bgnetwork.stats.data.BGNetworkStats;
import net.simflow.swf.analyzer.data.TupleStrInt;
import net.simflow.swf.analyzer.stringtrans.BGNetworkStatsStringGenerator;

public class BGGenerator extends AbstractGenerator {
	protected final static LinkedHashMap<String, Boolean> DEFAULT_CONFIG_BG = new LinkedHashMap<String, Boolean>();
	protected final static LinkedHashMap<String, Boolean> DEFAULT_CONFIG_FLOW = new LinkedHashMap<String, Boolean>();
	protected final static LinkedHashMap<String, Boolean> DEFAULT_CONFIG_SERVICE = new LinkedHashMap<String, Boolean>();
	static {
		DEFAULT_CONFIG_BG.put(BGNetworkStats.NETWORK_NAME, true);
		DEFAULT_CONFIG_BG.put(BGNetworkStats.NETWORK_FLOW_NEIGHBOR, true);
		DEFAULT_CONFIG_BG.put(BGNetworkStats.NETWORK_SERVICE_NEIGHBOR, true);
		DEFAULT_CONFIG_BG.put(BGNetworkStats.NETWORK_FLOW_DEGREE, true);
		DEFAULT_CONFIG_BG.put(BGNetworkStats.NETWORK_SERVICE_DEGREE, true);

		DEFAULT_CONFIG_FLOW.put(BGNetworkStats.FLOW_PART_NAME, true);
		DEFAULT_CONFIG_FLOW.put(BGNetworkStats.FLOW_PART_NEIGHBOR, true);
		DEFAULT_CONFIG_FLOW.put(BGNetworkStats.FLOW_PART_DEGREE, true);

		DEFAULT_CONFIG_SERVICE.put(BGNetworkStats.SERVICE_PART_NAME, true);
		DEFAULT_CONFIG_SERVICE.put(BGNetworkStats.SERVICE_PART_NEIGHBOR, true);
		DEFAULT_CONFIG_SERVICE.put(BGNetworkStats.SERVICE_PART_DEGREE, true);
	}

	private static BGGenerator instance = new BGGenerator();

	private BGGenerator() {
	}

	public static BGGenerator getInstance() {
		return instance;
	}

	@Override
	protected String getTitle(Object stats) {
		return "Bipartite Graph";
	}

	@Override
	protected ArrayList<TupleStrInt> getInfo(String style, Object stats) {
		return BGNetworkStatsStringGenerator.getInstance().generate(style,
				(BGNetworkStats) stats);
	}

	@Override
	public LinkedHashMap<String, Boolean> getDefaultConfig() {
		return DEFAULT_CONFIG_BG;
	}

	public LinkedHashMap<String, Boolean> getDefaultConfigBG() {
		return DEFAULT_CONFIG_BG;
	}

	public LinkedHashMap<String, Boolean> getDefaultConfigFlow() {
		return DEFAULT_CONFIG_FLOW;
	}

	public LinkedHashMap<String, Boolean> getDefaultConfigService() {
		return DEFAULT_CONFIG_SERVICE;
	}
}
